#ifndef	_PID_FREERTOS_H
#define _PID_FREERTOS_H
#ifndef F_CPU
#define		F_CPU			16000000UL
#endif
#include <util/delay.h>
#include "define.h"
//cross_line flag
#define		NO_LINE	0
#define		CROSS_LINE		2
#define 	IS_LINE			1
//#define		LEFT_LINE		2
//#define		RIGHT_LINE		3


extern int vantoc_R,vantoc_L,quang_duong;//use for encoder
			



void faster_speed(int *_stand_speed,int _speed_max);
//----------------------------------------------------------------
void slower_speed(int *_stand_speed,int _speed_min);
//----------------------------------------------------------------
unsigned char NumLedInLine(unsigned char sen);
//----------------------------------------------------------------

int keep_stable(char pos,int *dev_,int *stable_old_dev_,char stand_speed_);
//=====================================================
void check_crossline(unsigned char _sensor,unsigned char *_cross_flag); 
void test_sensor(unsigned char sensor_bits, int *dev_, int *old_dev_);
void calc_forward_pd(int _dev, int *_old_dev, int _stand_speed, int *l,int *r);
void hold_velocity(int velctl_L, int velctl_R, int L_velocity,int R_velocity);
void reset_hold_velocity(int *velctl_L, int *velctl_R, unsigned char *hole_velocity_flag);
//======================================================
#endif //_PID_FREERTOS_H